.class public Lcom/xingbook/park/ui/a;
.super Landroid/widget/ImageView;

# interfaces
.implements Landroid/view/View$OnClickListener;


# instance fields
.field private a:Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;

.field private b:Z

.field private c:Lcom/xingbook/park/ui/c;


# direct methods
.method public constructor <init>(Landroid/content/Context;F)V
    .locals 1

    invoke-direct {p0, p1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/xingbook/park/ui/a;->b:Z

    const v0, 0x7f020194

    invoke-virtual {p0, v0}, Lcom/xingbook/park/ui/a;->setImageResource(I)V

    invoke-virtual {p0, p0}, Lcom/xingbook/park/ui/a;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    new-instance v0, Lcom/xingbook/park/ui/c;

    invoke-direct {v0, p0}, Lcom/xingbook/park/ui/c;-><init>(Landroid/widget/ImageView;)V

    iput-object v0, p0, Lcom/xingbook/park/ui/a;->c:Lcom/xingbook/park/ui/c;

    const/16 v0, 0x8

    invoke-virtual {p0, v0}, Lcom/xingbook/park/ui/a;->setVisibility(I)V

    return-void
.end method

.method public static a(Landroid/content/Context;Landroid/widget/RelativeLayout;FIIII)Lcom/xingbook/park/ui/a;
    .locals 6

    const/high16 v4, 0x4309

    const/4 v5, 0x0

    new-instance v0, Lcom/xingbook/park/ui/a;

    invoke-direct {v0, p0, p2}, Lcom/xingbook/park/ui/a;-><init>(Landroid/content/Context;F)V

    const/high16 v1, 0x4100

    mul-float/2addr v1, p2

    float-to-int v1, v1

    invoke-virtual {v0, v5, v5, v1, v1}, Lcom/xingbook/park/ui/a;->setPadding(IIII)V

    new-instance v2, Landroid/widget/RelativeLayout$LayoutParams;

    mul-float v3, v4, p2

    float-to-int v3, v3

    add-int/2addr v3, v1

    mul-float/2addr v4, p2

    float-to-int v4, v4

    add-int/2addr v1, v4

    invoke-direct {v2, v3, v1}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    if-gtz p4, :cond_0

    if-lez p6, :cond_6

    :cond_0
    if-lez p4, :cond_1

    const/4 v1, 0x3

    invoke-virtual {v2, v1, p4}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(II)V

    :cond_1
    if-lez p6, :cond_2

    const/4 v1, 0x2

    invoke-virtual {v2, v1, p6}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(II)V

    :cond_2
    :goto_0
    if-gtz p3, :cond_3

    if-lez p5, :cond_7

    :cond_3
    if-lez p3, :cond_4

    const/4 v1, 0x1

    invoke-virtual {v2, v1, p3}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(II)V

    :cond_4
    if-lez p5, :cond_5

    invoke-virtual {v2, v5, p5}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(II)V

    :cond_5
    :goto_1
    invoke-virtual {v0, v2}, Lcom/xingbook/park/ui/a;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    invoke-virtual {p1, v0}, Landroid/widget/RelativeLayout;->addView(Landroid/view/View;)V

    return-object v0

    :cond_6
    const/16 v1, 0xc

    invoke-virtual {v2, v1}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(I)V

    goto :goto_0

    :cond_7
    const/16 v1, 0xb

    invoke-virtual {v2, v1}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(I)V

    goto :goto_1
.end method

.method static synthetic a(Lcom/xingbook/park/ui/a;Z)V
    .locals 0

    invoke-direct {p0, p1}, Lcom/xingbook/park/ui/a;->setPlayingHintState(Z)V

    return-void
.end method

.method private declared-synchronized setPlayingHintState(Z)V
    .locals 2

    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/xingbook/park/ui/a;->b:Z

    if-eq v0, p1, :cond_0

    iput-boolean p1, p0, Lcom/xingbook/park/ui/a;->b:Z

    if-eqz p1, :cond_1

    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/xingbook/park/ui/a;->setVisibility(I)V

    iget-object v0, p0, Lcom/xingbook/park/ui/a;->c:Lcom/xingbook/park/ui/c;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lcom/xingbook/park/ui/c;->a(Z)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :cond_0
    :goto_0
    monitor-exit p0

    return-void

    :cond_1
    const/16 v0, 0x8

    :try_start_1
    invoke-virtual {p0, v0}, Lcom/xingbook/park/ui/a;->setVisibility(I)V

    iget-object v0, p0, Lcom/xingbook/park/ui/a;->c:Lcom/xingbook/park/ui/c;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/xingbook/park/ui/c;->a(Z)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method


# virtual methods
.method protected onAttachedToWindow()V
    .locals 2

    iget-object v0, p0, Lcom/xingbook/park/ui/a;->a:Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;

    if-nez v0, :cond_0

    new-instance v0, Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;

    new-instance v1, Lcom/xingbook/park/ui/b;

    invoke-direct {v1, p0}, Lcom/xingbook/park/ui/b;-><init>(Lcom/xingbook/park/ui/a;)V

    invoke-direct {v0, v1}, Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;-><init>(Lcom/xingbook/ting/receiver/a;)V

    iput-object v0, p0, Lcom/xingbook/park/ui/a;->a:Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;

    iget-object v0, p0, Lcom/xingbook/park/ui/a;->a:Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;

    invoke-virtual {p0}, Lcom/xingbook/park/ui/a;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;->a(Landroid/content/Context;)V

    :cond_0
    :try_start_0
    sget-object v0, Lcom/xingbook/ting/play/MusicService;->s:Lcom/xingbook/ting/play/MusicService;

    if-eqz v0, :cond_1

    sget-object v0, Lcom/xingbook/ting/play/MusicService;->s:Lcom/xingbook/ting/play/MusicService;

    invoke-virtual {v0}, Lcom/xingbook/ting/play/MusicService;->n()Landroid/media/MediaPlayer;

    move-result-object v0

    if-eqz v0, :cond_2

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->isPlaying()Z

    move-result v0

    if-eqz v0, :cond_2

    const/4 v0, 0x1

    invoke-direct {p0, v0}, Lcom/xingbook/park/ui/a;->setPlayingHintState(Z)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_1
    :goto_0
    invoke-super {p0}, Landroid/widget/ImageView;->onAttachedToWindow()V

    return-void

    :cond_2
    const/4 v0, 0x0

    :try_start_1
    invoke-direct {p0, v0}, Lcom/xingbook/park/ui/a;->setPlayingHintState(Z)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public onClick(Landroid/view/View;)V
    .locals 3

    invoke-virtual {p0}, Lcom/xingbook/park/ui/a;->getContext()Landroid/content/Context;

    move-result-object v0

    new-instance v1, Landroid/content/Intent;

    const-class v2, Lcom/xingbook/ting/activity/TingPlayAct;

    invoke-direct {v1, v0, v2}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    instance-of v2, v0, Landroid/app/Activity;

    if-nez v2, :cond_0

    const/high16 v2, 0x1000

    invoke-virtual {v1, v2}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;

    :cond_0
    invoke-virtual {v0, v1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    return-void
.end method

.method protected onDetachedFromWindow()V
    .locals 2

    iget-object v0, p0, Lcom/xingbook/park/ui/a;->a:Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;

    invoke-virtual {p0}, Lcom/xingbook/park/ui/a;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/xingbook/ting/receiver/MusicServiceStateReceiver;->b(Landroid/content/Context;)V

    invoke-super {p0}, Landroid/widget/ImageView;->onDetachedFromWindow()V

    return-void
.end method
